<div class="nodesSort">
<?php foreach (array('all' => _('List all'), 'installed' => _('List installed'), 'local' => _('List local')) as $select_key => $select_label):?>
<?php   if ($select_key == @$requested_select):?>
  <span class="nodesSortCurrent"><?php _h($select_label);?></span> |
<?php   else:?>
<?php     link_to_remote($select_label, 'xigg-admin-plugin-list', array('base' => '/plugin/list', 'params' => array('select' => $select_key)));?>
  |
<?php   endif;?>
<?php endforeach;?>
</div>

  <table>
    <thead>
      <tr>
        <th>&nbsp;</th>
        <th class="left"><?php _e('Name');?></th>
        <th class="left"><?php _e('Summary');?></th>
        <th><?php _e('Installed');?></th>
        <th><?php _e('Local');?></th>
        <th><?php _e('Action');?></th>
      </tr>
    </thead>
    <tfoot>
      <tr><td colspan="6"></td></tr>
    </tfoot>
    <tbody>
<?php while ($e =& $entity_objects->getNext()):?>
<?php   $local_data = @$installed_plugins[$e->get('name')]; $version = $e->get('version'); $local_version = $local_data['version']; $can_upgrade = version_compare($version, $local_version, '<');?>
<?php   if ($error = ($e->get('active') && !empty($version) && empty($local_version))):?>
      <tr style="background-color:#fcc;">
        <td><img src="<?php echo $LAYOUT_URL;?>/images/plugin_error.png" alt="<?php _e('Error');?>" /></td>
<?php   else:?>
<?php     if ($can_upgrade):?>
      <tr style="background-color:#ffd;">
        <td><img src="<?php echo $LAYOUT_URL;?>/images/plugin_error.png" alt="<?php _e('Error');?>" /></td>
<?php     else:?>
      <tr>
<?php       if ($e->get('active')):?>
        <td><img src="<?php echo $LAYOUT_URL;?>/images/plugin.png" alt="<?php _e('Active');?>" /></td>
<?php       else:?>
        <td><img src="<?php echo $LAYOUT_URL;?>/images/plugin_disabled.png" alt="<?php _e('Disabled');?>" /></td>
<?php       endif;?>
<?php     endif;?>
<?php   endif;?>
        <td class="left"><?php _h($e->getLabel());?></td>
        <td class="left"><?php _h($local_data['summary']);?></td>
        <td><?php _h($version);?></td>
        <td><?php _h($local_version);?></td>
        <td>
<?php   /*if ($e->canUninstall())*/ link_to_remote(_('Uninstall'), 'xigg-admin-plugin-list-update', array('base' => '/plugin/' . $e->getId() . '/uninstall'));?>
<?php   if ($can_upgrade):?>&nbsp;
<?php     link_to_remote(_('Upgrade'), 'xigg-admin-plugin-list-update', array('base' => '/plugin/upgrade/' . $e->getLabel()));?>&nbsp;
<?php   elseif (!$error):?>&nbsp;
<?php     link_to_remote(_('Configure'), 'xigg-admin-plugin-list-update', array('base' => '/plugin/configure/' . $e->getLabel()));?>
<?php   endif;?>
        </td>
      </tr>
<?php endwhile;?>
<?php foreach($local_plugins as $local_name => $local_data):?>
      <tr style="background-color:#eee;">
        <td><img src="<?php echo $LAYOUT_URL;?>/images/plugin_disabled.png" alt="<?php _e('Disabled');?>" /></td>
        <td class="left"><?php _h($local_name);?></td>
        <td class="left"><?php _h($local_data['summary']);?></td>
        <td>&nbsp;</td>
        <td><?php _h($local_data['version']);?></td>
        <td><?php link_to_remote(_('Install'), 'xigg-admin-plugin-list-update', array('base' => '/plugin/install/' . $local_name));?></a></td>
      </tr>
<?php endforeach;?>
    </tbody>
  </table>

<div id="xigg-admin-plugin-list-update">
</div>